from django.conf.urls.defaults import *
from wiki.models import Category,Page
#from django.contrib.sitemaps import GenericSitemap

categorydict={
'queryset':Category.objects.all(),

}

recent_changes ={
'queryset':Page.objects.order_by('-edit_date')[:5],
}

pagesdict={
'queryset':Page.objects.all(),
'date_field':'edit_date',
}



urlpatterns = patterns('wiki.views',

#(r'^recent_changes/(?P<slug>[0-9A-Za-z-_]+)/$','history'),
(r'^category/show/(?P<slug>[0-9A-Za-z-_]+)/page(?P<page>[0-9]+)/$','category'),
(r'^category/show/(?P<slug>[0-9A-Za-z-_]+)/$','category'),
#(r'^category/edit/(?P<slug>[0-9A-Za-z-_]+)/$','category_edit'),
(r'^category/add/(?P<slug>[0-9A-Za-z-_]+)/$','category_add'),
#(r'^discussion/show/(?P<slug>[0-9A-Za-z-_]+)/$','discussion'),
#(r'^discussion/edit/(?P<slug>[0-9A-Za-z-_]+)/$','discussion_edit'),
#(r'^discussion/add/(?P<slug>[0-9A-Za-z-_]+)/$','discussion_add'),
(r'^category/add/$','category_add'),
(r'^show/(?P<slug>[0-9A-Za-z-_]+)/$', 'object_detail'),
(r'^add/(?P<slug>[0-9A-Za-z-_]+)/$', 'create_object'),
(r'^edit/(?P<slug>[0-9A-Za-z-_]+)/$','update_object'),
(r'^history/(?P<slug>[0-9A-Za-z-_]+)/$','history'),
#(r'^history/(?P<slug>[0-9A-Za-z-_]+)/page(?P<page>[0-9]+)/$','history'),
(r'^upload-file/$','upload')
	)
urlpatterns += patterns('django.views.generic',
(r'^category/page(?P<page>[0-9]+)/$','list_detail.object_list',categorydict),
(r'^category/$','list_detail.object_list',categorydict),
(r'^recent_changes/$','list_detail.object_list',recent_changes),
(r'^$', 'simple.redirect_to',{'url': '/wiki/show/Start/'}),

	)
	
#urlpatterns += patterns('',
#(r'^sitemap.xml$', 'django.contrib.sitemaps.views.sitemap', {'sitemaps': sitemaps}),
#)